﻿using AnesSystem.Models;
using AnesSystem.Services;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace AnesSystem
{
    public class AnesEventDataCache : EventDataCache
    {
        #region Variables


        #endregion


        #region Constructor

        #endregion


        #region Properties


        #endregion


        #region 依赖属性


        #endregion


        #region Event


        #endregion


        #region PrivateMethods


        #endregion


        #region Public/ProtectedMethods
        public override void DbSearch()
        {
            _patientLink = DataManager.Instance.CurrentPatientLink;
            DateTime startTime = _patientLink.Status.InRoomTime;
            DateTime anesStartTime = _patientLink.Status.AnesRecordStartTime;
            DateTime endTime;
            if (!_patientLink.Status.OutRoomTime.Equals(new DateTime()))
            {
                endTime = _patientLink.Status.OutRoomTime;
            }
            else
            {
                endTime = anesStartTime.AddHours((_patientLink.Status.TotalPage) * 4);
            }
            List<PatientEventsModel> patientEvents = PatientEventsService.Instance.GetPatientEvents8Time(_patientLink.Id.ToString(), startTime, endTime);
            foreach (var item in patientEvents)
            {
                AddUpdateEvent(item);
            }
    }

        #endregion


        #region EventHandlers


        #endregion

    }
}
